package org.shijiagen.product.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import org.shijiagen.param.ProductHotParam;
import org.shijiagen.param.ProductIdsParam;
import org.shijiagen.param.ProductSaveParam;
import org.shijiagen.param.ProductSearchParam;
import org.shijiagen.pojo.Picture;
import org.shijiagen.pojo.Product;
import org.shijiagen.to.OrderToProduct;
import org.shijiagen.utils.R;

import java.util.List;

public interface ProductService extends IService<Product> {
    /**
     * 单类别名称查询热门商品数据
     * @param categoryName
     * @return
     */
    Page<Product> promo(String categoryName);

    /**
     * 多类别名称查询热门商品数据
     * @param productHotParam
     * @return
     */
    Page<Product> hots(ProductHotParam productHotParam);

    /**
     * 查询所有类别
     * @return
     */
    R categoryList();

    Page<Product> byCategory(ProductIdsParam productIdsParam);

    Product detail(Integer productID);

    List<Picture> pictures(Integer productID);

    /**
     * 返回所有商品集合供搜索服务使用
     * @return
     */
    List<Product> allList();

    /**
     * 搜索商品，远程调用搜索服务
     * @param productSearchParam
     * @return
     */
    R search(ProductSearchParam productSearchParam);

    /**
     * 根据对应的商品id查找对应商品的详情集合
     * @param ids
     * @return
     */
    List<Product> productListByIds(List<Integer> ids);

    void subNumber(List<OrderToProduct> orderToProduct);

    Long adminCount(Integer categoryId);

    R adminSave(ProductSaveParam productSaveParam);

    R adminUpdate(Product product);

    R adminRemove(Integer productId);
}
